$(document).ready(function(e) {
	var num = 0 ;
	var partten = /^1[3,5,8]\d{9}$/;//判断手机格式正则
	$("#username,#password,#phone,#password2").hover(//输入框样式
		function() {$(this).css("background","#CCC");},
		function() {$(this).css("background","#FFF");}
	);
	window.setInterval(function(){//切换背景
		if(num==1){
			$("body").css("background","url(../images/me_03.jpg)");
			$("body").css("background-size","cover");
			$("body").css("background-repeat","no-repeat");
			$("body").css("background-attachment","fixed");
			num=0;
		}else if(num==0){
			$("body").css("background","url(../images/me_04.jpg)");
			$("body").css("background-size","cover");
			$("body").css("background-repeat","no-repeat");
			$("body").css("background-attachment","fixed");
			num=1;
		}
	},5000);
	$("#registerform").submit(function(){
		if($("#username").val().length<2||$("#username").val().length>8){
			//判断用户名格式
			alert("用户名长度错误");
			$("#username").focus();
			return false;
		}
		if(partten.test(($("#phone").val()))==false){
			//判断手机格式
		    alert("手机格式错误");
			return false;
		}
		if($("#password").val().length<6||$("#password").val().length>16){
			//判断密码格式
			alert("密码长度错误");
			$("#password").focus();
			return false;
		}
		if($("#password").val()!=$("#password2").val()){
			//判断前后密码是否一致
			alert("密码不一致");
			$("#password2").focus();
			return false;
		}
		return true;
	}
	);
});